package io.gitee.devaper.starlight.module.room.entity.vo

import io.gitee.devaper.starlight.module.room.websocket.*
import io.gitee.devaper.starlight.module.room.websocket.event.server.*

/**
 * 房间视频信息
 *
 * @param url 正在播放的视频URL
 * @param state 视频播放状态
 * @param speed 倍速
 * @param time 播放到的时间, 毫秒
 */
data class VideoVO(
    val url: String?,
    val state: VideoState,
    val speed: Double,
    val time: Long
) {

    companion object {

        fun valueOf(video: Video) = VideoVO(
            url = video.currentUrl(),
            state = video.currentState(),
            speed = video.currentSpeed(),
            time = video.currentTime()
        )

    }

}
